package com.example.redisreactive.service;

import com.example.redisreactive.dao.ReactiveRedisDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

@Service
public class UserService {

    private final ReactiveRedisDao redisDao;

    @Autowired
    public UserService(ReactiveRedisDao redisDao) {
        this.redisDao = redisDao;
    }

    public Mono<Boolean> saveUserData(String userId, String userData) {
        return redisDao.setKey(userId, userData);
    }

    public Mono<String> getUserData(String userId) {
        return redisDao.getValue(userId);
    }
}